﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ViewHttpHeaders.aspx.cs" Inherits="HTTPDebuggerTools.com.ViewHttpHeaders" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>HTTP Request/Response Viewer</title>
    <meta name="keywords" content="decode viewstate, viewstate decoder, parse viewstate" />

    <script src="Highlighter/shCore.js" type="text/javascript"></script>
    <script src="Highlighter/shBrushXml.js" type="text/javascript"></script>
    <link href="Highlighter/shCore.css" rel="stylesheet" type="text/css" />
    <link href="Highlighter/shThemeDefault.css" rel="stylesheet" type="text/css" />    
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
    
    <script type="text/javascript">
        window.onload = function() {
            if ($get('ResultData') != null) {
                $get('ResultData').style.display = 'block';
            }

            HideCustomBox();
        }

        function HideCustomBox() {
            var agentList = $get("<%= AgentList.ClientID %>");
            var customAgent = $get("<%= AgentBox.ClientID %>");

            if (agentList.value == "Custom...") {
                customAgent.style.display = 'block';
            }
            else {
                customAgent.style.display = 'none';
            }
        }

        SyntaxHighlighter.all();
    </script>
        
    <asp:NoBot ID="NoBot1" runat="server" />
    
    <h2>HTTP Request/Response Viewer</h2>

    <table>
        <tr>
            <th>
                <asp:Label ID="UrlLabel" runat="server" Text="HTTP(S) URL:" CssClass="font_bold"></asp:Label>
            </th>
            <td>
                <asp:TextBox ID="UrlBox" runat="server" Width="460px"></asp:TextBox>
                <asp:TextBoxWatermarkExtender ID="UrlBox_TextBoxWatermarkExtender" 
                    runat="server" Enabled="True" TargetControlID="UrlBox" 
                    WatermarkText="For example: http://www.google.com"
                    WatermarkCssClass="watermark">
                </asp:TextBoxWatermarkExtender>                              
            </td>            
        </tr>    
        <tr>
            <th>
                <asp:Label ID="ContentTypeLabel" runat="server" Text="Content Type:"></asp:Label>
            </th>
            <td>
                <asp:TextBox ID="ContentTypeBox" runat="server" Width="460px"></asp:TextBox>
                <asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" 
                    runat="server" Enabled="True" TargetControlID="ContentTypeBox" 
                    WatermarkText="For example: text/html"
                    WatermarkCssClass="watermark">
                </asp:TextBoxWatermarkExtender>            
            </td>            
        </tr>               
        <tr valign="top"> 
            <th>
                <asp:Label ID="ContentDataLabel" runat="server" Text="Content Data:"></asp:Label>
            </th>
            <td>
                <asp:TextBox ID="ContentDataBox" runat="server" Width="460px" TextMode="MultiLine"></asp:TextBox>
                <asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2" 
                    runat="server" Enabled="True" TargetControlID="ContentDataBox" 
                    WatermarkText="Request Content Data or POST parameters. For example:&#13;login=admin&password=pwd"
                    WatermarkCssClass="watermark">
                </asp:TextBoxWatermarkExtender>            
            </td>            
        </tr>                       
        <tr valign="top"> 
            <th>
                <asp:Label ID="HeadersLabel" runat="server" Text="Custom Headers:"></asp:Label>
            </th>
            <td>
                <asp:TextBox ID="HeadersBox" runat="server" Width="460px" TextMode="MultiLine"></asp:TextBox>
                <asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender3" 
                    runat="server" Enabled="True" TargetControlID="HeadersBox" 
                    WatermarkText="For example:&#13;Accept-Encoding: gzip,deflate&#13;Accept-Language: de"
                    WatermarkCssClass="watermark">
                </asp:TextBoxWatermarkExtender>            
            </td>            
        </tr>
        <tr>
            <th>
                <asp:Label ID="RefererLabel" runat="server" Text="Referer:"></asp:Label>
            </th>
            <td>
                <asp:TextBox ID="RefererBox" runat="server" Width="460px"></asp:TextBox>
                <asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender4" 
                    runat="server" Enabled="True" TargetControlID="RefererBox" 
                    WatermarkText="For example: http://www.httpdebugger.com"
                    WatermarkCssClass="watermark">
                </asp:TextBoxWatermarkExtender>            
            </td>            
        </tr>         
        <tr>
            <th>
                <asp:Label ID="AgentLabel" runat="server" Text="User Agent:"></asp:Label>
            </th>
            <td>
                <asp:DropDownList ID="AgentList" runat="server" Width="180px" 
                    onchange="HideCustomBox();">
                    <asp:ListItem Selected="True">Internet Explorer</asp:ListItem>
                    <asp:ListItem>Mozilla Firefox</asp:ListItem>
                    <asp:ListItem>Google Chrome</asp:ListItem>
                    <asp:ListItem>Opera</asp:ListItem>
                    <asp:ListItem>Googlebot</asp:ListItem>        
                    <asp:ListItem>Custom...</asp:ListItem>
                </asp:DropDownList>                
                <asp:TextBox ID="AgentBox" runat="server" Width="240px" CssClass="hide" ></asp:TextBox>
            </td>            
        </tr>        
        <tr>
            <th>
                <asp:Label ID="VersionLabel" runat="server" Text="HTTP Version:"></asp:Label>
            </th>
            <td>
                <asp:RadioButtonList ID="VersionsList" runat="server" 
                    RepeatDirection="Horizontal" ToolTip="HTTP Version">
                    <asp:ListItem Selected="True">HTTP/1.1</asp:ListItem>
                    <asp:ListItem>HTTP/1.0</asp:ListItem>
                </asp:RadioButtonList>                
            </td>            
        </tr>        
        <tr>
            <th>
                <asp:Label ID="MethodLabel" runat="server" Text="HTTP Method:"></asp:Label>
            </th>
            <td>
                <asp:RadioButtonList ID="MethodList" runat="server" 
                    RepeatDirection="Horizontal" ToolTip="HTTP Method">
                    <asp:ListItem Selected="True">GET</asp:ListItem>
                    <asp:ListItem>POST</asp:ListItem>
                    <asp:ListItem>PUT</asp:ListItem>
                    <asp:ListItem>DELETE</asp:ListItem>
                    <asp:ListItem>HEAD</asp:ListItem>
                </asp:RadioButtonList>  
            </td>   
        </tr>       
    </table>
    <br />
    <asp:Button ID="SubmitBtn" runat="server" Text="Submit" CssClass="font_bold" 
        onclick="SubmitBtn_Click"/>  
    
    <br />
    <br />
    <br />
    
    <asp:Literal ID="RequestHeaders" runat="server" Visible="false"></asp:Literal>
    <br />
    
    <asp:Literal ID="ResponseHeaders" runat="server" Visible="false"></asp:Literal>
    <br />
    
    <asp:Literal ID="ResultLiteral" runat="server" ></asp:Literal>                 
</asp:Content>
